// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import "../delegates"
import "../models"
import "../views"
import ".."

Rectangle {
    id: monthOfYear
    property alias time: monthJobs.fromTime
    signal addJob

    width: 160
    height: 170
    Utils {
        id: utils
    }

    Text {
        id: txt
        x: 0
        anchors.top: parent.top
        text: utils.getMonthName(month)
    }
    MounthJobs {
        id: monthJobs
        anchors.margins: 5
        anchors.top: txt.bottom
        anchors.bottom: parent.bottom
        anchors.left: parent.left
        anchors.right: parent.right
        cellWidth: 20
        cellHeight: 20
        model: monthModel
        highlight: Rectangle {}
        delegate: DayOfYearElement {
            m: monthModel.month
        }
        header: Component {
            Row {
                spacing: 0
                CalendarHeaderElement {dayOfWeek: 1; width: 20; height: 20}
                CalendarHeaderElement {dayOfWeek: 2; width: 20; height: 20}
                CalendarHeaderElement {dayOfWeek: 3; width: 20; height: 20}
                CalendarHeaderElement {dayOfWeek: 4; width: 20; height: 20}
                CalendarHeaderElement {dayOfWeek: 5; width: 20; height: 20}
                CalendarHeaderElement {dayOfWeek: 6; width: 20; height: 20}
                CalendarHeaderElement {dayOfWeek: 7; width: 20; height: 20}
            }
        }
        onAddJob: monthOfYear.addJob()
    }
}
